package com.taxt.ui.activity;

import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.hjq.widget.layout.SettingBar;
import com.taxt.R;
import com.taxt.aop.SingleClick;
import com.taxt.app.AppActivity;
import com.taxt.http.api.LoginApi;
import com.taxt.http.model.PersonInfoBean;
import com.taxt.other.SpUtils;
import com.taxt.other.ToolsUtils;
import com.taxt.ui.dialog.AddressDialog;
import com.taxt.ui.dialog.InputDialog;


/**
 * author : wq
 * <p>
 * time   : 2019/04/20
 * desc   : 个人资料
 */
public final class PersonalDataActivity extends AppActivity {
    private TextView mIdView;
    private TextView mUserCardType;
    private TextView mUserCardNum;
    private TextView mUserTaxPayer;
    private TextView mBirthView;
    private TextView mSexView;
    private TextView mCityView;
    private TextView mCityAlsoView;
    private TextView mCityUsedView;
    private TextView mStudyView;
    private TextView mCountyView;
    private TextView mCityDetailView;
    private TextView mCityAlsoDetailView;
    private TextView mCityUsedDetailView;
    private TextView mPersonMin;
    private TextView mPersonEmail;
    @Override
    protected int getLayoutId() {
        return R.layout.personal_data_activity;
    }

    @Override
    protected void initView() {
        mIdView = findViewById(R.id.person_data_name);
        mUserCardType = findViewById(R.id.user_card_type);
        mUserCardNum = findViewById(R.id.user_card_num);
        mUserTaxPayer = findViewById(R.id.user_tax_payer);
        mBirthView = findViewById(R.id.sb_person_birth_num);
        mSexView = findViewById(R.id.sb_person_sex);
        mCountyView = findViewById(R.id.user_country);
        mCityView = findViewById(R.id.sb_person_city);
        mCityDetailView = findViewById(R.id.sb_person_city_detail);
        mCityAlsoView = findViewById(R.id.sb_person_city_also);
        mCityAlsoDetailView = findViewById(R.id.sb_person_city_detail_also);
        mCityUsedView = findViewById(R.id.sb_person_city_also_used);
        mCityUsedDetailView = findViewById(R.id.sb_person_city_detail_also_used);
        mStudyView = findViewById(R.id.sb_person_study);
        mPersonMin=findViewById(R.id.sb_person_min);
        mPersonEmail=findViewById(R.id.sb_person_email);
    }

    @Override
    protected void initData() {
        PersonInfoBean personInfoBean= (PersonInfoBean) SpUtils.decodeParcelable("person",PersonInfoBean.class);
        if(personInfoBean!=null) {
            PersonInfoBean.PersonInfoDTO bean = personInfoBean.getPersonInfo();
            if (bean != null) {
                mIdView.setText(bean.getName());
                mUserCardType.setText(bean.getCardType());
                mUserCardNum.setText(ToolsUtils.idCardReplaceWithStar(bean.getCardId()));
                mUserTaxPayer.setText(ToolsUtils.idCardReplaceWithStar(bean.getTaxpayerIdentificationNumber()));
                mBirthView.setText(bean.getBirthday());
                mSexView.setText(bean.getSex());
                mCountyView.setText(bean.getNationality());
                mCityView.setText(bean.getHouseholdAdressSsq());
                mCityDetailView.setText(bean.getHouseholdAdressDetail());
                mCityAlsoView.setText(bean.getResidenceAdressSsq());
                mCityAlsoDetailView.setText(bean.getResidenceAdressDetail());
                mCityUsedView.setText(bean.getContactAdressSsq());
                mCityUsedDetailView.setText(bean.getContactAdressDetail());
                mStudyView.setText(bean.getEducation());
                mPersonMin.setText(bean.getNation());
                if (bean.getEmail() != null) {
                    mPersonEmail.setText(bean.getEmail());
                } else {
                    mPersonEmail.setText("请选择");
                }
            }
        }
    }


}